﻿<%@ Page Language="C#" AutoEventWireup="true"  CodeBehind="UserLogin.aspx.cs" Inherits="Wwtfly.BBS.ForeApplication.WebForm.UserLogin" %>
<%@ Register Src="~/WebForm/Shared/Head.ascx" TagName="WebHead" TagPrefix="headtop" %>
<%@ Register Src="~/WebForm/Shared/Foot.ascx" TagName="WebFood" TagPrefix="foodup" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>酷乐彩_登陆</title>
    <link rel="stylesheet" type="text/css" href="css/style.css" />
    <script src="Script/jquery-1.4.1-vsdoc.js" type="text/javascript"></script>
    <script src="Script/jquery-1.4.1.js" type="text/javascript"></script>
    <script src="Script/jquery-1.4.1.min.js" type="text/javascript"></script>
    <script src="Script/md5.js" type="text/javascript"></script>
</head>
<body>
    <form id="form1" runat="server">
     <input type="hidden" id="randCodes"  value="<%=randcodes %>"/>
    <div class="contanter">
      <headtop:WebHead ID="head1"  runat="server"/>
        <div class="location Fleft">
            您现在的位置：<a href="#">登录酷乐彩！</a></div>
        <div class="bodyer Fleft MTop">
            <div class="body_left Fleft">
                <table border="0" cellspacing="0" cellpadding="0" class="warp_table">
                    <tr>
                        <td colspan="2" style="width: 30%;">
                            <div class="login">
                                用户登录</div>
                        </td>
                    </tr>
                    <tr>
                        <td align="right">
                            用户名：
                        </td>
                        <td>
                            <input type="text" id="tusername" class="input" size="30" />
                        </td>
                    </tr>
                    <tr>
                        <td align="right">
                            密&nbsp;&nbsp;码：
                        </td>
                        <td>
                            <input type="password" id="tpassword" class="input" size="30" />
                        </td>
                    </tr>
                    <tr>
                        <td align="right">
                            验证码：
                        </td>
                        <td>
                            <input type="text" id="textCode" class="input" size="15" />
                            <img id="checkCode" src="Controller/CheckCode.aspx" onclick="Imgclick();" width="65" height="25" />&nbsp;&nbsp;<a href="javascript:void(0);"  onclick="Imgclick();">换一张</a>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            &nbsp;
                        </td>
                        <td>
                            <img id="loginUsers" src="images/login.jpg" width="100" height="35" /><span style="font-size: 12px;">&nbsp;&nbsp;还没有酷乐彩账户？
                                立即<a href="Register.aspx">免费注册&gt;&gt;</a></span>
                        </td>
                    </tr>
                </table>
            </div>
            <div class="body_right MLeft2 Fleft">
                <img src="images/20120504115231_2322.jpg" width="290" height="263" />
            </div>
        </div>
         <foodup:WebFood ID="food1"  runat="server"/>

    </div>
    </form>
    <script type="text/javascript">
        function Imgclick() {
            $("#checkCode").attr("src", "Controller/CheckCode.aspx?remode=" + Math.floor(Math.random() * 10 + 1));
        }
        $(document).ready(function () {


            $("#loginUsers").click(function () {
                var code = $("#textCode").val();
                if (code != "") {
                    var pwd = $("#tpassword").val();
                    var randcode = $("#randCodes").val();
                    var password = hex_md5(hex_md52(pwd).toUpperCase() + randcode);
                    $.post("ashx/UsersHandler.ashx",
                        {
                            parms: "login_pmusers",
                            tuserName: $("#tusername").val(),
                            tuserpwd: password,
                            trandcode: randcode,
                            textCode: $("#textCode").val()
                        }, function (result) {
                            if (result == "1") {
                                alert("登陆成功!");
                                window.location.href = "default.aspx";
                            } else if (result == "0") {
                                alert("输入密码错误!");
                            } else {
                                alert("用户密码不正确!");
                                //alert("服务器繁忙...请稍后!");
                            }
                        });
                } else {
                    alert("验证码不能为空!");
                }

            });
        });
    </script>
</body>
</html>
